<%@ Page Title="" Language="VB" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage(Of SurvivorPool.AdminRepository)" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Survivor Pool - All Users
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
       View list of all users</h2>
    <% If Not Model.IsAdmin Then%>
    <h3>
        <i>You must be an administrator to view this page.</i></h3>
    <% Else%>
    
    <table class="data-table">
        <tr>
            <th scope="col">Display Name</th>
            <%--<th>Username</th>--%>
            <th scope="col"><font size=1>E-mail</font></th>
            <%--<th>Has Paid</th>--%>
            <th scope="col" colspan="4">Picks for Round 1</th>
            <th scope="col" colspan="2"> Picks for Round 2</th>
            <th scope="col">Rd 3</th>
            <th scope="col">Rd 4</th>
            <th scope="col">Rd 5</th>
            <th scope="col">Rd 6</th>
        </tr>
        <%  Dim rowCount As Integer = 0
         For Each item In Model.ListOfPicks
                If rowCount Mod 2 = 0 Then Response.Write("<tr>") Else Response.Write("<tr class=""row-alternating"">")
    
                Response.Write("<th scope=""row"">" & Html.Encode(item.User.DisplayName) & "</th>")
                'Response.Write("<td><font size=2>" & Html.Encode(item.User.UserName) & "</font></td>")
                Response.Write("<td><font size=1>" & Html.Encode(item.User.Email) & "</font></td>")
                'Response.Write("<td>" & Html.Encode(item.User.DisplayHasPaid) & "</td>")

                For Each subItem In item.Picks
                    If subItem.BracketRound > 2 AndAlso Not String.IsNullOrEmpty(subItem.TeamDisplayWithRegion) Then
                        Response.Write("<td>****</td>")
                    Else
                        Response.Write("<td>" & Html.Encode(subItem.TeamDisplayWithRegion) & "</td>")
                    End If
                Next
                rowCount += 1
                Response.Write("</tr>")
            Next%>
    </table>
    <% End If%>
</asp:Content>
